﻿@{
    ViewBag.Title = "众筹项目管理";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutCMS.cshtml";
}
@using LY.Business.ServiceImpl
@using LY.Interface
@model LY.Entity.R_Project
<link href="~/Content/assets/css/Layout/css/main.css" rel="stylesheet" />
<script src="~/Content/assets/app/common/ajaxupload.js"></script>
<script>
    $(function () {
        //$(".additem input").attr("disabled", "disabled").addClass("disabled");;
    })
</script>
<script src="~/Content/assets/DatePicker/WdatePicker.js"></script>
<div class="container">
    <div id="forms" class="mt10">
        <div class="box">
            <div class="box_border">
                <div class="box_top"><b class="pl15">众筹项目详情</b>@*<b class="pl151">众筹人</b><b class="pl151">众筹公司</b>*@</div>
                <div class="box_center">
                    @using (Ajax.BeginForm("ProjectSave", new AjaxOptions() { OnSuccess = "OnSuccess" }))
                    {  
                        <div class="additem" style="padding: 10px;">
                            <input type="hidden" id="Id" name="Id" value="@Model.Id"/>
                            <input type="hidden" id="AddTime" name="AddTime" value="@Model.AddTime"/>
                            <input type="hidden" id="MemberId" name="MemberId" value="@Model.MemberId"/>
                            <input type="hidden" id="ProjectStatus" name="ProjectStatus" value="@Model.ProjectStatus"/>
                            <input type="hidden" id="AuditStatus" name="AuditStatus" value="@Model.AuditStatus"/>
                            <input type="hidden" id="UserId" name="MemberId" value="@Model.UserId"/>
                            <dl>
                                <dt>项目类型：</dt>
                                <dd>
                                    @Html.ResourceRadioList("ProjectClass", "ProjectType", Model.ProjectClass, new { datatype = "*" })
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;项目名称：</dt>
                                <dd>
                                    <input type="text" class="input normal1" id="ProjectName" name="ProjectName"  tip="不多于60个字" datatype="*,s0-60" value="@Model.ProjectName" />
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;一句话说明：</dt>
                                <dd>
                                    <input type="text" class="input normal1" id="ProjectAdWord" datatype="*" tip="请用一句话概括项目内容（不多于200字）" name="ProjectAdWord" value="@Model.ProjectAdWord" />
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;筹资金额：</dt>
                                <dd>
                                    <input type="text" class="input txt" id="Amount" datatype="num" tip="不少于XX元" name="Amount" nullmsg="请输入筹资金额" value="@Model.Amount"/>元
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;筹资天数：</dt>
                                <dd>
                                    <input type="text" class="input txt" id="CollectDays" datatype="n" name="CollectDays" value="@Model.CollectDays"/>天
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;项目简介：</dt>
                                <dd>
                                    <textarea id="ProjectSummary" class="input normal1" rows="4" name="ProjectSummary" datatype="*">@Model.ProjectSummary</textarea>
                                </dd>
                            </dl>
                            <dl>
                                <dt>项目详情：</dt>
                                <dd>
                                    <input type="text" class="input normal1" id="ProjectDetails" name="ProjectDetails" datatype="*" value="@Model.ProjectDetails" />
                                </dd>
                            </dl>
                            <dl>
                                <dt>视频介绍：</dt>
                                <dd>
                                    <input type="text" class="input normal1" id="VideoAddr" name="VideoAddr"  value="@Model.VideoAddr"/></dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;首页图片：</dt>
                                <dd>
                                    <img id="imgShow" style="width: 650px; height: 500px" src="@Model.ProjectThumImage"/>
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;频道图片：</dt>
                                <dd>
                                    <img id="imgShow1" style="width: 596px; height: 698px" src="@Model.ProjectThumImage1" />
                                </dd>
                            </dl>
                            <dl>
                                <dt><span style="color: red">*</span>&nbsp;列表图片：</dt>
                                <dd>
                                    <img id="imgShow1" style="width: 279px; height: 224px" src="@Model.ProjectThumImage2" />
                                </dd>
                            </dl>
                        </div>  
                        
                        }
                </div>
                <div class="box_center">
                    <div>众筹人信息</div>
                    <div class="additem" style="padding: 10px;">
                        <dl>
                            <dt>众筹人账号：</dt>
                            <dd>
                                @ViewBag.member.Name
                            </dd>
                        </dl>
                        <dl>
                            <dt>真实姓名：</dt>
                            <dd>
                                @ViewBag.member.RealName
                            </dd>
                        </dl>
                        <dl>
                            <dt>身份证号码：</dt>
                            <dd>
                                @ViewBag.member.IDCode
                            </dd>
                        </dl>
                        <dl>
                            <dt>手机号码：</dt>
                            <dd>
                                @ViewBag.member.Mobilenumber
                            </dd>
                        </dl>
                        <dl>
                            <dt>地址：</dt>
                            <dd>
                                @ViewBag.member.Address
                            </dd>
                        </dl>
                    </div>
                </div>
                <div class="box_center">
                    @if (@ViewBag.company != null)
                    {                       
                        <div>众筹企业信息</div>
                        <div class="additem" style="padding: 10px;">
                            <dl>
                                <dt>众筹企业名称：</dt>
                                <dd>
                                    @ViewBag.company.CompanyName
                                </dd>
                            </dl>
                            <dl>
                                <dt>地址：</dt>
                                <dd>
                                    @ViewBag.company.Adress
                                </dd>
                            </dl>
                        </div>
                    }
                </div>
                <div class="box_center">
                    <div class="additem" style="padding: 10px;">
                        <dl>
                            <dt>审核内容:</dt>
                            <dd>
                                <textarea id="RefuseReason" class="input normal" style="min-height: 100px; width: 700px;" rows="50" name="RefuseReason" datatype="*">@Model.RefuseReason</textarea>
                            </dd>
                        </dl>
                        <dl>
                            <dt>审核记录:</dt>
                            <dd>
                                @{
                                    IProjectService _projectService = new ProjectService();
                                    var flowlist = _projectService.SelectPorjectFlow(Model.Id);
                                    foreach (var item in flowlist)
                                    {
                                        @item.Content1<br />
                                    }
                                }
                            </dd>
                        </dl>
                    </div>
                </div>
                <div class="box_center">
                    @if (Model.AuditStatus == 200)
                    {
                        <div class="additem" style="padding: 0px;">

                            <dl>
                                <dt>上线时间:</dt>
                                <dd>
                                    <input type="text" id="BeginTime" onclick=" WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' }) " readonly="true" name="BeginTime" value="@Model.BeginTime" class="input-text lh30" size="40">
                                </dd>
                            </dl>
                        </div>
                    }
                </div>
                <div style="width: 100%; text-align: center;">
                    <div style="margin: 0 auto;">
                        @if (Model.AuditStatus == 200)
                        {
                            <input id="btnBack" type="button" name="button" class="btn btn82 btn_save2" value="撤回" />
                            <input id="btnAudit" type="button" name="button" class="btn btn82 btn_save2" value="发布" />
                        }
                        else if (Model.AuditStatus == 210)
                        {
                            <input id="btnBack" type="button" name="button" class="btn btn82 btn_save2" value="撤回" />
                        }
                        else
                        {
                            <input id="btnBack" type="button" name="button" class="btn btn82 btn_save2" value="退回" />
                            <input id="btnAudit" type="button" name="button" class="btn btn82 btn_save2" value="通过" />
                        }
                        <input id="btnReturn" type="button" name="button" class="btn btn82 btn_res" value="返回" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
    <script src="~/Content/assets/DatePicker/WdatePicker.js"></script>

<script type="text/javascript">
    //图片上传初始化
    var util = {};
    var options = {
        Audit: "@Url.Action("ProjectSave")",
        uploadUrl: "@Url.Action("UploadImg", "Helper")"
    };


    //编辑器
    KindEditor.ready(function (K) {
        window.editor = K.create('#ProjectDetails', {
            resizeType: 1,
            allowPreviewEmoticons: false,
            allowImageUpload: true,
            minWidth: 350,
            minHeight: 600,
            allowFileManager: true,
            afterBlur: function () {
                this.sync();
            }
        });
    });
    //验证初始化
    $("form").Validform({
        tiptype: 3
    });


    $(document).ready(function () {

        //审核通过
        $("#btnAudit").click(function (e) {
            $.post(options.Audit, { id: $('#Id').val(), PassOrNo: "pass", RefuseReason: $('#RefuseReason').val(),BeginTime:$('#BeginTime').val() },
                function (res) {
                    if (res.Status > 0) {
                        alert("操作成功！");
                        //window.location.href = "/Admin/T_Project/ProjectAuditList";
                        window.location.href = "/Admin/ProjectMgr/ProjectIndex/?projectStatus=" + @Model.AuditStatus;
                    }
                    else {
                        alert("操作失败！");
                    }
                },
                "json"
            );
        });

        //审核不通过
        $("#btnBack").click(function (e) {

            $.post(options.Audit, { id: $('#Id').val(), PassOrNo: "no", RefuseReason: $('#RefuseReason').val() },
                function (res) {
                    if (res.Status > 0) {
                        alert("操作成功！");
                        //window.location.href = "/Admin/T_Project/ProjectAuditList";
                        window.location.href = "/Admin/ProjectMgr/ProjectIndex/?projectStatus=" + @Model.AuditStatus;
                    }
                    else {
                        alert("操作失败！");
                    }
                },
                "json"
            );
        });

    });

</script>
